package cc.rengu.redp.bizimpl.upmp.service;

import cc.rengu.redp.bizimpl.upmp.domain.BTermBrandInfo;
import cc.rengu.redp.bizimpl.upmp.domain.BTermModelInfo;
import cc.rengu.redp.bizimpl.upmp.vo.BTermBrandInfoVO;
import cc.rengu.redp.bizimpl.upmp.vo.BTermModelInfoVO;
import cc.rengu.redp.common.domain.QueryRequest;
import cc.rengu.redp.common.exception.RedpException;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * @author lizk
 */
public interface IBTermModelInfoService extends IService<BTermModelInfo> {

    IPage<BTermModelInfo> findByPage(QueryRequest request, BTermModelInfoVO model);

    @Transactional
    void createModel(BTermModelInfoVO model) throws RedpException;

    @Transactional
    void updateModel(BTermModelInfoVO model) throws RedpException;

    List<BTermModelInfo> findTests();

    /**
     * 批量插入
     *
     * @param list List<BTermModelInfoVO>
     */
    @Transactional
    void batchInsert(List<BTermModelInfoVO> list, String brandCode) throws RedpException;

    int countModel(String brandCode);

    List<BTermModelInfo> getByBrandCode(String brandCode);

    BTermModelInfo getModelName(String brandCode, String modelCode);

    boolean checkModelNameAndCodeExist(String modelName, String modelCode);

    BTermModelInfo findTermModel(String modelCode);

    Map<String, Object> termmodelSelect2List(String q, QueryRequest request);
}
